package offer;

public class IsSymmetric_28 {
    public boolean isSymmetric(TreeNode root) {
        if(root == null) return true;
        return build(root.left,root.right);


    }
    public boolean build(TreeNode left,TreeNode right){
        if(left == null && right == null){
            return true;
        }
        if(left == null){
            return false;
        }
        if(right == null){
            return false;
        }
        if(left.val != right.val){
            return false;
        }
        return build(left.left,right.right) && build(left.right,right.left);
    }
}
